<?php

namespace app\controller;

use app\BaseController;
use shop\Index;

class Main extends BaseController
{
    public function getGoodsList()
    {
        $page = input('page', 0);
        $limit = input('limit', 20);
        $sort = input('sort', 'add_time');
        $sort_type = input('sort_type', 'desc');
        [$bool, $data] = Index::getGoodsList($page, $limit, $sort, $sort_type);
        return $bool ? $this->returnJson(200,$data) : $this->returnJson(404,$data);
    }
    public function getGoodsInfo()
    {
        $sku = input('sku', 0);
        $library = input('library', 0);
        $queryExts = input('queryExts', '');
        [$bool, $data] = Index::getGoodsInfo($sku, $library, $queryExts);
        return $bool ? $this->returnJson(200,$data) : $this->returnJson(404,$data);
    }
}